package handler

import (
	"github.com/gin-gonic/gin"
	"choujiang/common/models"
	"choujiang/common/utils"
	"choujiang/common/consts"
	"choujiang/box_server/service"
)

/**
 @description 获取登陆用户，已购买游戏推广信息接口
 @return []model.games
 @author guxiang
 @version v1 2018-11-27
 */
func BoughtGames(c *gin.Context) {
	gameId := c.Request.Form.Get("gameId")
	uniqueId := c.Request.Form.Get("uniqueId")
	user := model.GetUserByUniqueId(uniqueId)
	if user == nil {
		utils.Error(consts.ErrUserNotFound, c)
		return
	}
	games := service.GetPromoteGame(gameId, user.Id, 1)
	utils.JSON(games, c)
}
